import socket

# 1. 创建客户端 socket 对象
clientSocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)

# 2. 与服务器服务建立连接
clientSocket.connect(('127.0.0.1',9999))

# 3. 接收服务端发送的信息
msg = clientSocket.recv(1024)
print(msg.decode(encoding='utf-8'))

# 4. 发送信息到服务端
msg_s = '消息已收到，So Easy!'
clientSocket.send(msg_s.encode())

# 5. 关闭连接
clientSocket.close()